import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import getters from './getters'

import router from '../router'

Vue.use(Vuex);
const mutations = {
    changeRoute(state, {path, replace, go, params, query}) {
        if (replace) {
            router.replace(path);
        } else if (path) {
            router.push({path, params, query});
        } else if (go) {
            router.go(go);
        }
    }
};
const state = {};
const store = new Vuex.Store({
    state,
    actions,
    getters,
    modules: {},
    mutations
});

export default store
